<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>扫描</title>
    <link rel="stylesheet" href="/resources/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/resources/css/bootstrap.min.css"/>
    <script src="/resources/js/jquery.min.js"></script>
    <script src="/resources/js/bootstrap.min.js"></script>
    <script src="/resources/layui/css/layui.css"></script>
    <script src="/resources/layui/layui.js"></script>
    <script src="/resources/js/vue.js"></script>
    <script src="/resources/js/bootstrap.js"></script>
</head>
<body>

<div class="layui-tab">
    <ul class="layui-tab-title">
        <li class="layui-this">录入</li>
        <li>查看</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">

            <form class="layui-form" id="formDemo">
                <div class="table-responsive">
                    <h4>信息</h4>
                    <table class="table table-bordered table-striped">
                        <tbody>
                        <tr>
                            <td>单号：</td>
                            <td >
                                <input type="text" name="id" id="id" required lay-verify="required" placeholder="输入单号" autocomplete="off" class="layui-input" >
                            </td >
                            <td colspan="4">
                                <button type="button" class="layui-btn" onclick="chaxun();">查询</button>
                                <button type="button" onclick="luru();" class="layui-btn" lay-filter="formDemo">录入</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </td>
                        </tr>
                        </tbody>
                    </table>
                    <div>
                        <table class="table table-bordered table-striped">
                            <tbody>
                            <tr>
                                <td>单号：</td>
                                <td colspan="5">
                                    <input type="text" name="id" id="did" placeholder="单号" autocomplete="off" class="layui-input" disabled>
                                </td >
                            </tr>

                            <tr >
                                <td>寄件人姓名：</td>
                                <td> <input type="text" name="khName" id="khName" placeholder="寄件人姓名" autocomplete="off" class="layui-input" disabled></td>
                                <td>寄件人电话：</td>
                                <td> <input type="text" name="phone" id="phone" placeholder="寄件人电话" autocomplete="off" class="layui-input" disabled></td>
                                <td>寄件人地址：</td>
                                <td> <input type="text" name="daoda" id="daoda" placeholder="寄件人地址" autocomplete="off" class="layui-input" disabled></td>
                            </tr>

                            <tr>
                                <td>收件人姓名：</td>
                                <td> <input type="text" name="shName" id="shName" placeholder="收件人姓名" autocomplete="off" class="layui-input" disabled></td>
                                <td>收件人电话：</td>
                                <td> <input type="text" name="shPhone" id="shPhone" placeholder="收件人电话" autocomplete="off" class="layui-input" disabled></td>
                                <td>收件人地址：</td>
                                <td> <input type="text" name="address" id="address" placeholder="收件人地址" autocomplete="off" class="layui-input" disabled></td>
                            </tr>

                            <tr >
                                <td>物品：</td>
                                <td> <input type="text" name="hpName" id="hpName" placeholder="物品" autocomplete="off" class="layui-input" disabled></td>
                                <td>重量：</td>
                                <td> <input type="text" name="hpZhongliang" id="hpZhongliang" placeholder="重量" autocomplete="off" class="layui-input" disabled></td>
                                <td>件数：</td>
                                <td> <input type="text" name="hpCount" id="hpCount" placeholder="件数" autocomplete="off" class="layui-input" disabled></td>

                            </tr>
                            <tr >
                                <td>操作人：</td>
                                <td> <input type="text" name="" placeholder="操作人" id="" autocomplete="off" class="layui-input" disabled></td>
                                <td>上车时间：</td>
                                <td colspan="3"> <input type="text" name="qDeta" id="qDeta" placeholder="上车时间" autocomplete="off" class="layui-input" disabled></td>

                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-tab-item">


            <table id="demo" lay-filter="test"></table>
        </div>
        </div>

    </div>
</div>


</body>
</html>


<script>
    var table;
    layui.use('table', function(){
        table = layui.table;
        //第一个实例
        table.render({
            elem: '#demo'
            ,url: 'http://localhost:8888/panku/list' //数据接口
            ,page: true //开启分页
            ,cols: [[ //表头
                {field: 'id', title: '编号'}
                ,{field: 'yewuId', title: '工作单号',templet:function (d) {
                    var str=" -";
                    if (d.yeweu!=null){
                        str=d.yeweu.id;
                    }
                        return str;
                    }}
                ,{field: 'scDate', title: '上车时间'}
                ,{field: 'caozuir', title: '操作人'}
                ,{field: 'address', title: '地点',templet:function(d){
                    var strs = " -";
                    if (d.yeweu!=null) {
                        strs = d.yeweu.address;
                    }
                    return strs
                    }}
            ]]
        });

    });
    function luru(){
        var id=$("#id").val();
        var address=$("#address").val();
        $.get("http://localhost:8888/panku/tianjia",{yewuId: id,address:address},function (d) {
            layui.layer.msg("已录入!!");
            table.reload('deom');
        })
    }
</script>

<script>
    //注意：选项卡 依赖 element 模块，否则无法进行功能性操作
    layui.use('element', function(){
        var element = layui.element;
    });
</script>


<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#test1' //指定元素
        });
    });
</script>

<script>
    function chaxun() {
        var id=$("#id").val();
        $.get("http://localhost:8888/yeweu/listid",{id:id}, function (d) {
            var data = d.data;
            $("#did").val(data.id);
            $("#phone").val(data.phone);
            $("#khName").val(data.khName);
            $("#shName").val(data.shName);
            $("#shPhone").val(data.shPhone);
            $("#daoda").val(data.daoda);
            $("#qDeta").val(data.qDeta);
            $("#beizhu").val(data.beizhu);
            $("#hpName").val(data.hpName);
            $("#address").val(data.address);
            $("#hpCount").val(data.hpCount);
            $("#hpZhongliang").val(data.hpZhongliang);
        });
    }
</script>

<script>
    var table,layer;
    layui.use('table', function(){
        table = layui.table;
        layer=layui.layer;
    });
</script>


           